#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;



class Solution {
public:
    string reverseWords(string s)
    {
        int prev = 0;
        auto begin = s.begin();
        int n = s.size();
        for (int i = 0; i < n || i != string::npos;)
        {
            i = s.find(' ', i);
            reverse(begin + prev, begin + i);
            prev = ++i;
        }
        reverse(begin + prev, s.end());
        return s;
    }
};

//
class Solution {
public:
    int maxPower(string s)
    {
        int len = 1;
        int tmp = 1;
        int n = s.size();
        for (int i = 1; i < n; i++)
        {
            if (s[i] == s[i - 1]) tmp++;
            else
            {
                tmp = 1;
            }
            len = max(len, tmp);
        }

        return len;
    }
};



int main()
{
	//int a = 10;
	//int& b = a;
	//int c = 102;
	//b = c;
	//std::cout << b << std::endl;


    Solution s;
    s.reverseWords("Let's take LeetCode contest");

	return 0;
}